package com.im.chat.config;

import com.im.chat.domain.enums.CommandType;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.stream.Collectors;

@Component
public class CommandConfig {

    public static Map<Integer, String> commandType = new HashMap<Integer, String>();


    @PostConstruct
    public void init (){
        System.out.println("=================");
        CommandType[] values = CommandType.values();
        commandType =  Arrays.stream(values).collect(Collectors.toMap(i -> i.getCode(), i -> i.getType()));
        System.out.println("=================");
    }
}
